package com.mujin.keji.collectionsystem.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.mujin.keji.collectionsystem.db.domain.SaveVisitRecordBean;

import io.reactivex.Flowable;

/**
 * 外访守则操作
 */
@Dao
public interface VisitRecordDao {

    /**
     * 查询外访条数，待外访，已外访，已完成
     * @return
     */
    @Query("select * from rc_cp_visitor_record where visitApplyId = (:applyId)")
    Flowable<SaveVisitRecordBean> findVisitRecord(Long applyId);

    @Query("select * from rc_cp_visitor_record where visitApplyId = (:applyId)")
    SaveVisitRecordBean findVisitRecordDetail(Long applyId);

    @Insert
    void insertViistRecord(SaveVisitRecordBean ...saveVisitRecordBeans);

    @Update
    void updateViistRecord(SaveVisitRecordBean saveVisitRecordBean);

    @Delete
    void delete(SaveVisitRecordBean saveVisitRecordBean);
}
